package com.object.module.didi.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.object.module.didi.entity.DdUserEntity;
import com.object.module.didi.service.DdUserService;
import com.object.configuration.utils.PageUtils;
import com.object.configuration.utils.Q;


/**
 * 用户 
 *
 * @author 小🌤
 * @email 1578442339@qq.com
 * @date 2021-10-30 15:57:53
 */
@RestController
@RequestMapping("/dd/user")
public class DdUserController {
    @Autowired
    private DdUserService ddUserService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public Q list(@RequestParam Map<String, Object> params) {
        PageUtils page = ddUserService.queryPage(params);
        return Q.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{urId}")
    public Q info(@PathVariable("urId") Integer urId) {
            DdUserEntity ddUser = ddUserService.getById(urId);
            return Q.ok().put("ddUser", ddUser);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public Q save(@RequestBody DdUserEntity ddUser) {
            ddUserService.save(ddUser);
            return Q.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public Q update(@RequestBody DdUserEntity ddUser) {
            ddUserService.updateById(ddUser);
            return Q.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public Q delete(@RequestBody Integer[] urIds) {
            ddUserService.removeByIds(Arrays.asList(urIds));
            return Q.ok();
    }

}
